package com.cap.dreamcircle.View.Adapter.Item;

import android.app.Activity;
import android.content.Intent;
import android.support.v4.app.ActivityCompat;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.cap.dreamcircle.Common.RecyclerView.BaseItem;
import com.cap.dreamcircle.Model.Bean.DreamLabelEntity;
import com.cap.dreamcircle.R;
import com.cap.dreamcircle.Utils.KeyCounterUtils;
import com.cap.dreamcircle.View.DreamLabelStreamActivity;

/**
 * Created by liucxu on 2017/12/22.
 */

public class SearchDreamLabelItem extends BaseItem<DreamLabelEntity> {

    private DreamLabelEntity entity;
    private TextView tv_search_label;

    public SearchDreamLabelItem(ViewGroup parent) {
        super(parent);
    }

    @Override
    public int getRes() {
        return R.layout.adapter_search_dream_label;
    }

    @Override
    public void onCreateView(View rootView) {
        tv_search_label=(TextView)rootView.findViewById(R.id.tv_search_label);
    }

    @Override
    public void onBindView(DreamLabelEntity dreamLabelEntity) {
        tv_search_label.setText(dreamLabelEntity.getTagName());
        entity=dreamLabelEntity;
    }

    @Override
    public void onClick(View v) {
        KeyCounterUtils.SendKeyCounter("257dcab2edf1415587412768e9d7460b");
        Intent intent = new Intent(getContext(), DreamLabelStreamActivity.class);
        intent.putExtra("tagId", entity.getId()+"");
        intent.putExtra("tagName", entity.getTagName());
        ActivityCompat.startActivity((Activity) getContext(), intent, null);
    }
}
